package common.splitpage.sql;

import common.splitpage.Condition;
import common.splitpage.PageInfo;

public class HSQLPageSql implements IPageSql {

	private Condition condition;
	private String sql;
	
	public HSQLPageSql(PageInfo pageInfo) {
		this.condition = pageInfo.getCondition();
		this.sql = condition.getSql();
	}

	public String getPageSql() {
		int startRow = condition.getStartRow()-1;//从0算起,所以要减1
		int pageRowCount = condition.getPageRowCount();
		return "select limit " + startRow + " " + pageRowCount + " * from (" + this.sql + ") temp ";
	}
}
